package com.bupt.server.serviceImpl;

import com.bupt.server.entity.Room;
import com.bupt.server.mapper.RoomMapper;
import com.bupt.server.ret.Data;
import com.bupt.server.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RoomServiceImpl implements RoomService {
    @Autowired
    RoomMapper roomMapper;

    @Override
    public int checkInCreateRoom(Data data,int room_id) {
        String customer_id = data.getCustomer_id();
        String password = data.getPassword();
        String room_type = data.getRoom_type();
        return roomMapper.checkInInsertRoom(room_id,customer_id,password,room_type);
    }

    @Override
    public Room enterRoom(Data data) {
        return roomMapper.enterRoomCheck(data.getRoom_id(), data.getPassword());
    }

    @Override
    public Room checkRoomInfo(Data data) {
        return roomMapper.checkRoomInfo(data.getRoom_id());
    }

    @Override
    public int updateRoomSpeed(Data data) {
        return roomMapper.updateRoomSpeed(data.getRoom_id(), data.getSpeed());
    }

    @Override
    public int updateRoomTargetTemp(Data data) {
        return roomMapper.updateRoomTargetTemp(data.getRoom_id(),data.getTemp());
    }

    @Override
    public int updateRoomACStatus(Data data) {
        System.out.println(data.getStatus());
        return roomMapper.updateRoomACStatus(data.getRoom_id(), data.getStatus());
    }


}
